package com.wanghcs.utils;

import java.io.InputStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 用于加载类,资源文件等
 * @author Xredman
 *
 */
public class ClassLoaderUtil {
	private static Log logger = LogFactory.getLog(ClassLoaderUtil.class);
	private static String respath = "";
	
	static {
		respath = Thread.currentThread().getContextClassLoader().getResource("") + "";
	}
	/**
	 * 加载Java类,使用全名
	 * @param className
	 * @return
	 */
	public static Class loadClass(String className) {
		try {
			return getClassLoader().loadClass(className);
		} catch(ClassNotFoundException e) {
			throw new RuntimeException("Class Not Fount " + className, e);
		}
	}
	
	public static ClassLoader getClassLoader() {
		return ClassLoaderUtil.class.getClassLoader();
	}
	
/*	public static InputStream getStream(String relativePath){
		
	}*/
	
	//public static 
	
	public static String getResPath() {
		return respath;
	}
}
